#include"SList.h"

void TestSlist1()
{
	//SLTNode* plist = NULL;
	//SListPushFront(&plist, 1);
	//SListPushFront(&plist, 2);
	//SListPushFront(&plist, 3);
	//SListPushFront(&plist, 4);
	//SListPushFront(&plist, 5);
	//SListPrint(plist);

	//SListPopFront(&plist);
	//SListPopFront(&plist);
	//SListPopFront(&plist);
	//SListPopFront(&plist);
	//SListPopFront(&plist);
	//SListPopFront(&plist);
	//SListPrint(plist);
}
void TestSlist2()
{
	SLTNode* plist = NULL;
	SListPushBack(&plist, 1);
    SListPushBack(&plist, 2);
    SListPushBack(&plist, 3);

    SListPrint(plist);

	SListPopBack(&plist);
	SListPopBack(&plist);
	SListPopBack(&plist);

	SListPrint(plist);

}


void TestSlist3()
{
	SLTNode* plist = NULL;
	SListPushBack(&plist, 1);
	SListPushBack(&plist, 2);
	SListPushBack(&plist, 3);
	SListPushBack(&plist, 4);
	SListPrint(plist);

	SLTNode* pos = SListFind(plist, 3);
	if (pos)
	{
		pos->data *= 10;	
	}
	SListPrint(plist);

	pos = SListFind(plist, 2);
	if (pos)
	{
		SListInsert(&plist, pos, 20);
	}
	SListPrint(plist);

	pos = SListFind(plist, 1);
	if (pos)
	{
		SListInsert(&plist, pos, 10);
	}
	SListPrint(plist);

	SListDestory(&plist);
}


int main()
{
	//TestSlist1();

	TestSlist2();

	return 0;
}